#!/usr/bin/env python
#-*- coding:utf8 -*-
import os
import web
from config import routes, environment
from vendor import system
app = system.application(routes.urls, {}, autoreload = True)
path= web.session.DiskStore('tmp/sessions')
sess= web.session.Session(app, path, initializer = {'login':False})
def session_hook():
    web.ctx.session = sess
if __name__ == "__main__":
    app.add_processor(web.loadhook(session_hook))
    #use for nginx
    #web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
    app.run()
